import { componentTypes as formCompnentsMap } from "../compMapConfig";

export function getFormCompMap() {
  return {
    input: {
      component: formCompnentsMap.input.component,
      icon: "icon-input",
      type: "input",
      state: {
        value: "",
      },
      editConfig: {
        label: {
          // component: formCompnentsMap.input.editConfig.label.component,
          value: "",
        },
        placeholder: {
          // component: formCompnentsMap.input.editConfig.placeholder.component,
          value: "",
        },
      },
    },
    number: {
      component: formCompnentsMap.number.component,
      icon: "icon-number",
      type: "number",
      state: {
        value: "",
      },
      editConfig: {
        placeholder: {
          // component: formCompnentsMap.input.editConfig.placeholder.component,
          value: "",
        },
      },
    },
    select: {
      component: formCompnentsMap.select.component,
      icon: "icon-select",
      type: "select",
      state: {
        value: 1,
      },
      editConfig: {
        options: {
          component: formCompnentsMap.select.editConfig.options.component,
          value: [
            { label: "默认选项1", value: 1 },
            { label: "默认选项2", value: 2 },
          ],
        },
        label: {
          // component: formCompnentsMap.input.editConfig.label.component,
          value: "",
        },
        placeholder: {
          // component: formCompnentsMap.input.editConfig.placeholder.component,
          value: "",
        },
      },
    },
    vSelect: {
      component: formCompnentsMap.vSelect.component,
    },
  };
}
export const componentDefaultConfig = readonly({
  vSelect: () => ({
    value: 1,
    options: [
      { label: "默认选项1", value: 1 },
      { label: "默认选项2", value: 2 },
    ],
  }),
  radio: () => ({
    value: 1,
    options: [
      { label: "默认选项1", value: 1 },
      { label: "默认选项2", value: 2 },
    ],
  }),
  checkbox: () => ({
    value: [1],
    options: [
      { label: "默认选项1", value: 1 },
      { label: "默认选项2", value: 2 },
    ],
  }),
  treeSelect: () => ({
    value: "1",
    options: [
      {
        value: "1",
        label: "Level one 1",
        children: [
          {
            value: "1-1",
            label: "Level two 1-1",
            children: [
              {
                value: "1-1-1",
                label: "Level three 1-1-1",
              },
            ],
          },
        ],
      },
    ],
  }),
  segmented: () => ({
    value: "默认选项1",
    options: ["默认选项1", "默认选项2"],
  }),
  autocomplete: () => ({
    fetchSuggestions: [],
  }),
  cascader: () => ({
    value: "guide",
    options: [
      {
        value: "guide",
        label: "Guide",
        children: [
          {
            value: "disciplines",
            label: "Disciplines",
            children: [
              {
                value: "consistency",
                label: "Consistency",
              },
              {
                value: "feedback",
                label: "Feedback",
              },
              {
                value: "efficiency",
                label: "Efficiency",
              },
              {
                value: "controllability",
                label: "Controllability",
              },
            ],
          },
          {
            value: "navigation",
            label: "Navigation",
            children: [
              {
                value: "side nav",
                label: "Side Navigation",
              },
              {
                value: "top nav",
                label: "Top Navigation",
              },
            ],
          },
        ],
      },
    ],
  }),
});
